#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time    : 2025/3/27 23:45
@Author  : HZP
@File    : app.py
"""
from dotenv import load_dotenv
from flask_login import LoginManager
from flask_migrate import Migrate
from injector import Injector

from config import Config, _get_bool_env
from internal.middleware import Middleware
from internal.router import Router
from internal.server import Http
from module import ExtensionModule
from pkg.sqlalchemy import SQLAlchemy

load_dotenv()
injector = Injector([ExtensionModule])
config = Config()

app = Http(
    __name__,
    db=injector.get(SQLAlchemy),
    login_manager=injector.get(LoginManager),
    migrate=injector.get(Migrate),
    middleware=injector.get(Middleware),
    conf=config,
    router=injector.get(Router)
)

if __name__ == '__main__':
    app.run(debug=_get_bool_env('DEBUG'))
